home *** CD-ROM | disk | FTP | other *** search
/ IRIX Base Documentation 2001 May / SGI IRIX Base Documentation 2001 May.iso / usr / share / catman / p_man / cat3dm / old-compression / clCompressImage.z / clCompressImage
Encoding:
Text File  |  1998-10-20  |  7.5 KB  |  133 lines

  1.  
  2.  
  3.  
  4. ccccllllCCCCoooommmmpppprrrreeeessssssssIIIImmmmaaaaggggeeee((((3333ddddmmmm))))                                      ccccllllCCCCoooommmmpppprrrreeeessssssssIIIImmmmaaaaggggeeee((((3333ddddmmmm))))
  5.  
  6.  
  7.  
  8. NNNNAAAAMMMMEEEE
  9.      clCompressImage, clDecompressImage - Compress/Decompress a single image
  10.  
  11. SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
  12.      ####iiiinnnncccclllluuuuddddeeee <<<<ddddmmmmeeeeddddiiiiaaaa////ccccllll....hhhh>>>>
  13.  
  14.      iiiinnnntttt ccccllllCCCCoooommmmpppprrrreeeessssssssIIIImmmmaaaaggggeeee((((iiiinnnntttt sssscccchhhheeeemmmmeeee,,,, iiiinnnntttt wwwwiiiiddddtttthhhh,,,, iiiinnnntttt hhhheeeeiiiigggghhhhtttt,,,,
  15.          iiiinnnntttt ffffoooorrrrmmmmaaaatttt,,,, ffffllllooooaaaatttt ccccoooommmmpppprrrreeeessssssssiiiioooonnnnRRRRaaaattttiiiioooo,,,, vvvvooooiiiidddd ****ffffrrrraaaammmmeeeeBBBBuuuuffffffffeeeerrrr,,,,
  16.          iiiinnnntttt ****ccccoooommmmpppprrrreeeesssssssseeeeddddBBBBuuuuffffffffeeeerrrrSSSSiiiizzzzeeeePPPPttttrrrr,,,, vvvvooooiiiidddd ****ccccoooommmmpppprrrreeeesssssssseeeeddddBBBBuuuuffffffffeeeerrrr))))
  17.      iiiinnnntttt ccccllllDDDDeeeeccccoooommmmpppprrrreeeessssssssIIIImmmmaaaaggggeeee((((iiiinnnntttt sssscccchhhheeeemmmmeeee,,,, iiiinnnntttt wwwwiiiiddddtttthhhh,,,, iiiinnnntttt hhhheeeeiiiigggghhhhtttt,,,,
  18.          iiiinnnntttt ffffoooorrrrmmmmaaaatttt,,,, iiiinnnntttt ccccoooommmmpppprrrreeeesssssssseeeeddddBBBBuuuuffffffffeeeerrrrSSSSiiiizzzzeeee,,,,
  19.          vvvvooooiiiidddd ****ccccoooommmmpppprrrreeeesssssssseeeeddddBBBBuuuuffffffffeeeerrrr,,,, vvvvooooiiiidddd ****ffffrrrraaaammmmeeeeBBBBuuuuffffffffeeeerrrr))))
  20.  
  21. AAAARRRRGGGGUUUUMMMMEEEENNNNTTTTSSSS
  22.      _s_c_h_e_m_e    The compression/decompression scheme to use.
  23.  
  24.      _w_i_d_t_h     The width of the image.
  25.  
  26.      _h_e_i_g_h_t    The height of the image.
  27.  
  28.      _f_o_r_m_a_t    The format of the original image to (de)compress :
  29.                CCCCLLLL____FFFFOOOORRRRMMMMAAAATTTT____BBBBGGGGRRRR, CCCCLLLL____FFFFOOOORRRRMMMMAAAATTTT____XXXXBBBBGGGGRRRR, CCCCLLLL____FFFFOOOORRRRMMMMAAAATTTT____AAAABBBBGGGGRRRR,
  30.                CCCCLLLL____FFFFOOOORRRRMMMMAAAATTTT____BBBBGGGGRRRR333333332222, CCCCLLLL____FFFFOOOORRRRMMMMAAAATTTT____GGGGRRRRAAAAYYYYSSSSCCCCAAAALLLLEEEE, CCCCLLLL____FFFFOOOORRRRMMMMAAAATTTT____YYYYCCCCbbbbCCCCrrrr,
  31.                CCCCLLLL____FFFFOOOORRRRMMMMAAAATTTT____YYYYCCCCbbbbCCCCrrrr444422222222, or CCCCLLLL____FFFFOOOORRRRMMMMAAAATTTT____YYYYCCCCbbbbCCCCrrrr444422222222DDDDCCCC.
  32.  
  33.      _c_o_m_p_r_e_s_s_i_o_n_R_a_t_i_o
  34.                The target compression ratio. The actual compression ratio
  35.                depends on this value and the particular codec.  A value of 0.0
  36.                indicates the default should be used.
  37.  
  38.      _f_r_a_m_e_B_u_f_f_e_r
  39.                A pointer to the frame buffer.
  40.  
  41.      _c_o_m_p_r_e_s_s_e_d_B_u_f_f_e_r_S_i_z_e_P_t_r
  42.                A pointer to the size of the compressed data buffer in bytes.
  43.                The value pointed to is overwritten by ccccllllCCCCoooommmmpppprrrreeeessssssssIIIImmmmaaaaggggeeee to
  44.                return the actual size of the compressed data.
  45.  
  46.      _c_o_m_p_r_e_s_s_e_d_B_u_f_f_e_r_S_i_z_e
  47.                The size of the compressed data in bytes.
  48.  
  49.      _c_o_m_p_r_e_s_s_e_d_B_u_f_f_e_r
  50.                A pointer to the compressed data buffer.
  51.  
  52. DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
  53.      ccccllllCCCCoooommmmpppprrrreeeessssssssIIIImmmmaaaaggggeeee compresses the image in _f_r_a_m_e_B_u_f_f_e_r and stores the result
  54.      in _c_o_m_p_r_e_s_s_e_d_B_u_f_f_e_r and the resulting size in _c_o_m_p_r_e_s_s_e_d_B_u_f_f_e_r_S_i_z_e_P_t_r.
  55.  
  56.      ccccllllDDDDeeeeccccoooommmmpppprrrreeeessssssssIIIImmmmaaaaggggeeee decompresses the data in _c_o_m_p_r_e_s_s_e_d_B_u_f_f_e_r of size
  57.      _c_o_m_p_r_e_s_s_e_d_B_u_f_f_e_r_S_i_z_e and stores the resulting image in _f_r_a_m_e_B_u_f_f_e_r.
  58.  
  59.      The values of the state parameters used with the other compression
  60.  
  61.  
  62.  
  63.                                                                         PPPPaaaaggggeeee 1111
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. ccccllllCCCCoooommmmpppprrrreeeessssssssIIIImmmmaaaaggggeeee((((3333ddddmmmm))))                                      ccccllllCCCCoooommmmpppprrrreeeessssssssIIIImmmmaaaaggggeeee((((3333ddddmmmm))))
  71.  
  72.  
  73.  
  74.      library calls have no effect on these routines, however their default
  75.      values do. _w_i_d_t_h, _h_e_i_g_h_t, _f_o_r_m_a_t, and _c_o_m_p_r_e_s_s_i_o_n_R_a_t_i_o are interpreted in
  76.      the same manner as the corresponding state parameters, but are given as
  77.      direct parameters so that they may be specified in the same call.
  78.  
  79.  
  80. RRRREEEETTTTUUUURRRRNNNNSSSS
  81.      Each function returns SUCCESS, or a negative error code on failure.
  82.  
  83.  
  84.  
  85. EEEEXXXXAAAAMMMMPPPPLLLLEEEE
  86.           /* Compress and decompress a 320 by 240 XBGR image with JPEG */
  87.           int frameIndex, compressedBufferSize, maxCompressedBufferSize;
  88.           int *compressedBuffer, frameBuffer[320][240];
  89.  
  90.           /* malloc a big enough buffer */
  91.           maxCompressedBufferSize = 320 * 240 * CL_BytesPerPixel(CL_FORMAT_XBGR)
  92.                                     + clQueryMaxHeaderSize(CL_JPEG_SOFTWARE);
  93.           compressedBuffer = (int *)malloc(maxCompressedBufferSize);
  94.  
  95.           /* Compress and decompress it */
  96.           clCompressImage(CL_JPEG_SOFTWARE, 320, 240, CL_FORMAT_XBGR, 15.0,
  97.               frameBuffer, &compressedBufferSize, compressedBuffer);
  98.           clDecompressImage(CL_JPEG_SOFTWARE, 320, 240, CL_FORMAT_XBGR,
  99.               compressedBufferSize, compressedBuffer, frameBuffer);
  100.  
  101.  
  102. SSSSEEEEEEEE AAAALLLLSSSSOOOO
  103.      CLintro(3dm)
  104.  
  105.  
  106.  
  107.  
  108.  
  109.  
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.                                                                         PPPPaaaaggggeeee 2222
  130.  
  131.  
  132.  
  133.